package org.acme;

import java.util.Collection;

import javax.persistence.EntityManager;

public class MovieService {
	private EntityManager em;

	public MovieService(EntityManager em) {
		this.em = em;
	}

	
	public Collection<String> getAllMovies() {
		return em.createQuery("SELECT m.name FROM Movie m").getResultList();
	}
	
	public void createMovie(String name, float price) {
		em.persist(new Movie(name, price, SampleEnum.DVA));
	}
}
